<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
	prefix="logic"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
	prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
	prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display-el"%>
<%@ taglib uri="ford-arg/tags" prefix="ft"%>
<%@ taglib uri="http://www.j2ee.ford.com/fjf-ui" prefix="ui"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<script type="text/javascript" language="javascript"
	src="./scripts/ajaxSearch.js">
</script>
<script language="JavaScript" src="./scripts/popups.js"></script>
<SCRIPT language="JavaScript" src="./scripts/CalendarPopup.js">
</SCRIPT>


<script language="javascript">
	var cal = new CalendarPopup(); 
	cal.showNavigationDropdowns();
	cal.setMonthNames('<bean:message key="label.month.january"/>',
						'<bean:message key="label.month.february"/>',
						'<bean:message key="label.month.march"/>',
						'<bean:message key="label.month.april"/>',
						'<bean:message key="label.month.may"/>',
						'<bean:message key="label.month.june"/>',
						'<bean:message key="label.month.july"/>',
						'<bean:message key="label.month.august"/>',
						'<bean:message key="label.month.september"/>',
						'<bean:message key="label.month.october"/>',
						'<bean:message key="label.month.november"/>',
						'<bean:message key="label.month.december"/>');
	cal.setDayHeaders('<bean:message key="label.day.sunday.capital"/>',
						'<bean:message key="label.day.monday.capital"/>',
						'<bean:message key="label.day.tuesday.capital"/>',
						'<bean:message key="label.day.wednesday.capital"/>',
						'<bean:message key="label.day.thursday.capital"/>',
						'<bean:message key="label.day.friday.capital"/>',
						'<bean:message key="label.day.saturday.capital"/>');
	cal.setTodayText('<bean:message key="label.today"/>');
	
	
	function createUpdatePricing(){
		document.PricingForm.action = "PricingActionCreateUpdate.do";
		document.PricingForm.operation.value = "createUpdate";
		document.PricingForm.submit();
	}
	
	
	function deletePricing(rowNum) {
		if (confirm('<bean:message key="supply.confirmDelete" /> ')) {
			document.PricingForm.action = "PricingActionDelete.do";
			document.PricingForm.operation.value = "delete";
			document.PricingForm.selectedRowNum.value = rowNum;
		}else{
			return false;
		}
	}
	function findPricing(){
		document.PricingForm.action = "PricingActionFind.do";
		document.PricingForm.operation.value = "find";
		document.PricingForm.submit();
	}
	
	function editPricing(obj){
		document.PricingForm.action = "PricingActionEditSelected.do";
		document.PricingForm.operation.value = "edit";
		document.PricingForm.selectedRowNum.value = obj;

	}
	
	function clearFindFilds (){
		document.PricingForm.action = "PricingActionCleanFind.do";
		document.PricingForm.operation.value = "clean";
		document.PricingForm.submit();
	}
	function clearPanelFilds (){
		document.PricingForm.action = "PricingActionCleanPanel.do";
		document.PricingForm.operation.value = "clean";
		document.PricingForm.submit();
	}
	
</script>

<table>
	<tr>
		<td colspan="2">
		<h2><bean:message key="pricing.label.title" /></h2>
		</td>
	</tr>
</table>
<br />
<html:form action="/PricingActionFind">
	<%-- Mantiene el numero de pagina despues del submit --%>
	<ft:saveActivePageNumber />

	<html:hidden property="modePanel" />
	<html:hidden property="operation" />
	<html:hidden property="selectedRowNum" />


	<bean:define id="nameTitle">
		<bean:message key="part.label.tableHeader.description" />
	</bean:define>
	<bean:define id="partTitle">
		<bean:message key="supply.label.table.header.part" />
	</bean:define>
	<bean:define id="currentTitle">
		<bean:message key="supply.label.table.header.current" />
	</bean:define>
	<bean:define id="priceTitle">
		<bean:message key="supply.label.table.header.price" />
	</bean:define>
	<bean:define id="fechaInTitle">
		<bean:message key="supply.label.table.header.dateOut" />
	</bean:define>
	<bean:define id="fechaOutTitle">
		<bean:message key="supply.label.table.header.dateIn" />
	</bean:define>
	<bean:define id="supplierTitle">
		<bean:message key="supply.label.table.header.supplier" />
	</bean:define>
	<bean:define id="actionsTitle">
		<bean:message key="part.label.tableHeader.actions" />
	</bean:define>
	<bean:define id="shareTitle">
		<bean:message key="supply.label.table.header.share" />
	</bean:define>
	<bean:define id="tvmValueTitle">
		<bean:message key="supply.label.table.header.TVMValue" />
	</bean:define>
	<bean:define id="tvmUpdateTitle">
		<bean:message key="supply.label.table.header.TVMupdate" />
	</bean:define>
	<bean:define id="createTitle">
		<bean:message key="supply.label.table.header.creation" />
	</bean:define>
	<bean:define id="uploadTitle">
		<bean:message key="supply.label.table.header.upload" />
	</bean:define>

	<!-- Text by CurrenciPrice -->
	<bean:define id="currentPrice">
		<bean:message key="supply.label.table.header.currentPrice" />
	</bean:define>

	<bean:define id="dateIn">
		<bean:message key="supply.label.table.header.dateIn" />
	</bean:define>

	<bean:define id="dateOut">
		<bean:message key="supply.label.table.header.dateOut" />
	</bean:define>

	<!--  End Titles -->
	<table style="width: 900px;" class="no_border">
		<tr>
			<td class="text_blue_bold align_left" colspan="1"><bean:message
				key="part.label.filter" /></td>
		</tr>
		<tr>
			<td class="text_blue_bold align_left"><bean:message
				key="part.label.supplier" /></td>
			<td class="align_left" width="88"><html:select
				property="supplierF" styleId="supplierClass">
				<html:option value="-1">
					<bean:message key="label.allOption" />
				</html:option>
				<html:options collection="partClassColl" property="value"
					labelProperty="label" />
			</html:select></td>
			<td class="align_left" width="40"><html:text
				styleId="supplierCode" property="supplierCodeF" maxlength="6"
				size="9" /></td>
			<td class="text_blue_bold align_left"><html:button property=""
				onclick="searchNameSupplier('result','supplierCode','supplierClass');">.&nbsp.&nbsp.</html:button>
			<html:button property="suppdsad"
				onclick="findSupplierPopup('supplierClass','supplierCode');">&nbsp?&nbsp</html:button>
			</td>
			<td class="text_blue_bold align_left" colspan="1">
			<div id="result" title="result" style="display: inline;"></div>
			</td>

		</tr>
		<tr>
			<td class="text_blue_bold align_left" width="88"><bean:message
				key="part.label" /></td>
			<td class="align_left" width="88"><html:select property="partCF"
				styleId="partClass">
				<html:option value="-1">
					<bean:message key="label.allOption" />
				</html:option>
				<html:options collection="partClassColl" property="value"
					labelProperty="label" />
			</html:select></td>
			<td class="align_left"><html:text property="partPreCF"
				maxlength="10" size="9" styleId="partPrefix" /></td>
			<td class="text_blue_bold align_left" colspan="2"><html:text
				property="partBaseF" maxlength="10" size="9" styleId="partBase" />&nbsp
			&nbsp <html:text property="partSufixF" maxlength="10" size="9"
				styleId="partSuffix" /> &nbsp &nbsp &nbsp <html:button property=""
				onclick="searchNamePart('resultPart','partClass','partPrefix','partBase','partSuffix');">.&nbsp.&nbsp.</html:button>
			<html:button property=""
				onclick="findPartPopup('supplierClass', 'supplierCode', 'partClass', 'partPrefix', 'partBase', 'partSuffix');">&nbsp?&nbsp</html:button>
				<div id="resultPart" title="resultPart" style="display: inline;">
				</div>
			</td>
		</tr>
		<tr>
			<td class="text_blue_bold align_left"><bean:message
				key="supply.label.effDateIn" /></td>
			<td class="text_blue_bold align_left" colspan="2"><html:text
				styleId="dateInEffStart" property="dateInEffStart" maxlength="10"
				size="10" /><A name="dateInMinAnchor1"> </A><html:button
				property="calendar"
				onclick="cal.select(document.PricingForm.dateInEffStart,'dateInMinAnchor1','dd/MM/yyyy'); return false;"
				styleClass="button_small">...</html:button> <bean:message
				key="label.and" /> <html:text styleId="dateInEffEnd"
				property="dateInEffEnd" maxlength="10" size="10" /><A
				name="dateInMaxAnchor1"> </A><html:button property="calendar"
				onclick="cal.select(document.PricingForm.dateInEffEnd,'dateInMaxAnchor1','dd/MM/yyyy'); return false;"
				styleClass="button_small">...</html:button></td>
			<td class="text_blue_bold align_left"><bean:message
				key="supply.label.effDateOut" /></td>
			<td class="text_blue_bold align_left"><html:text
				styleId="dateOutEffStart" property="dateOutEffStart" maxlength="10"
				size="10" /><A name="dateOutMinAnchor"> </A><html:button
				property="calendar"
				onclick="cal.select(document.PricingForm.dateOutEffStart,'dateOutMinAnchor','dd/MM/yyyy'); return false;"
				styleClass="button_small">...</html:button> <bean:message
				key="label.and" /> <html:text styleId="dateOutEffEnd"
				property="dateOutEffEnd" maxlength="10" size="10" /><A
				name="dateOutMaxAnchor"> </A><html:button property="calendar"
				onclick="cal.select(document.PricingForm.dateOutEffEnd,'dateOutMaxAnchor','dd/MM/yyyy'); return false;"
				styleClass="button_small">...</html:button></td>
			<td class="align_right"><html:button property="clean"
				styleClass="button_small" onclick="clearFindFilds();">
				<bean:message key="label.clean" />
			</html:button></td>
			<td class="align_left"><html:button property="find"
				onclick="findPricing();" styleClass="button_small">
				<bean:message key="label.find" />
			</html:button></td>
		</tr>
	</table>
	<br />

	<div class="edit_out align_center" style="width:850px;">
	<div class="edit align_center" style="width: 850px;">
	<table style="width: 900px;" class="no_border">

		<!-- Panel Mode Creation -->
		<logic:equal property="modePanel" value="new" name="PricingForm">
			<tr>
				<td class="text_blue_bold align_left" width="158"><bean:message
					key="part.label.supplier" /></td>
				<td width="88"><html:select
					property="teess01Supplier.eess01SupplierClassCodeC"
					styleId="supplierClassNew">
					<html:option value="-1">
						<bean:message key="label.allOption" />
					</html:option>
					<html:options collection="partClassCollNew" property="value"
						labelProperty="label" />
				</html:select></td>
				<td class="align_left">&nbsp&nbsp&nbsp&nbsp&nbsp <html:text
					property="teess01Supplier.eess01SupplierCodeC" maxlength="6"
					size="9" styleId="supplierCodeNew" /> &nbsp&nbsp&nbsp&nbsp <html:button
					property="find"
					onclick="searchNameSupplier('nameSupplierNew','supplierCodeNew','supplierClassNew')">.&nbsp.&nbsp.</html:button>
				<html:button property="sa" onclick="findSupplierPopup('supplierClassNew','supplierCodeNew');">&nbsp?&nbsp</html:button></td>
				<td class="text_blue_bold align_left">
				<div id="nameSupplierNew" title="nameSupplierNew"
					style="display: inline;"></div>
				</td>
				<td><html:button styleClass="button_small" property="update"
					onclick="createUpdatePricing();">
					<bean:message key="label.createUpdate" />
				</html:button></td>
			</tr>
			<tr>
				<td class="text_blue_bold align_left" width="158"><bean:message
					key="part.label" /></td>
				<td width="88"><html:select
					property="teesp01Part.eesp01PartClassCodeC" styleId="partClassN">
					<html:option value="-1">
						<bean:message key="label.allOption" />
					</html:option>
					<html:options collection="partClassCollNew" property="value"
						labelProperty="label" />
				</html:select></td>
				<td class="align_left">&nbsp&nbsp&nbsp&nbsp&nbsp <html:text
					property="teesp01Part.eesp01PartPrefixCodeC" maxlength="10"
					size="9" styleId="partPrefixN" /> &nbsp&nbsp&nbsp <html:text
					property="teesp01Part.eesp01PartBaseCodeC" maxlength="10" size="9"
					styleId="partBaseN" /> &nbsp&nbsp <html:text
					property="teesp01Part.eesp01PartSuffixCodeC" maxlength="10"
					size="9" styleId="partSuffixN" /> &nbsp <html:button
					property="ast"
					onclick="searchNamePart('partNew','partClassN','partPrefixN','partBaseN','partSuffixN');">.&nbsp.&nbsp.</html:button>
				<html:button property="sadw"
					onclick="findPartPopup('supplierClassNew','supplierCodeNew','partClassN','partPrefixN','partBaseN','partSuffixN');">&nbsp?&nbsp</html:button>
				</td>
				<td class="text_blue_bold align_left">
				<div id="partNew" style="display: inline;"></div>
				</td>
				<td><html:button property="clean" styleClass="button_small"
					onclick="clearPanelFilds();">
					<bean:message key="label.clean" />
				</html:button></td>
			</tr>
		</logic:equal>
		<!-- END Panel Mode Creation -->
		<tr>
		</tr>
		<!-- Panel Mode Edit -->
		<logic:equal property="modePanel" value="edit" name="PricingForm">
			<tr>
				<td class="text_blue_bold align_left" width="158"><bean:message
					key="part.label.supplier" /></td>
				<td width="88"><html:select
					property="teess01Supplier.eess01SupplierClassCodeC" disabled="true">
					<html:option value="-1">
						<bean:message key="label.allOption" />
					</html:option>
					<html:options collection="partClassCollNew" property="value"
						labelProperty="label" />
				</html:select></td>
				<td class="align_left">&nbsp&nbsp&nbsp&nbsp&nbsp <html:text
					styleId="supplierCode"
					property="teess01Supplier.eess01SupplierCodeC" maxlength="6"
					size="9" disabled="true" /> &nbsp&nbsp <html:button
					property="find" onclick="searchNamePartNew()" disabled="true">...</html:button>
				<html:button property="" disabled="true"> ? </html:button></td>
				<td>
				<div id="nameSupplierNew" title="nameSupplierNew"></div>

				</td>

				<td><html:button styleClass="button_small" property="update"
					onclick="createUpdatePricing();">
					<bean:message key="label.createUpdate" />
				</html:button></td>
			</tr>
			<tr>
				<td class="text_blue_bold align_left" width="158"><bean:message
					key="part.label" /></td>
				<td width="88"><html:select
					property="teesp01Part.eesp01PartClassCodeC" disabled="true">
					<html:option value="-1">
						<bean:message key="label.allOption" />
					</html:option>
					<html:options collection="partClassCollNew" property="value"
						labelProperty="label" />
				</html:select></td>
				<td class="align_left">&nbsp&nbsp&nbsp&nbsp <html:text
					property="teesp01Part.eesp01PartPrefixCodeC" maxlength="10"
					size="9" disabled="true" /> &nbsp&nbsp&nbsp&nbsp <html:text
					property="teesp01Part.eesp01PartBaseCodeC" maxlength="10" size="9"
					disabled="true" /> &nbsp&nbsp <html:text
					property="teesp01Part.eesp01PartSuffixCodeC" maxlength="10"
					size="9" disabled="true" /> &nbsp<html:button property=""
					disabled="true">.&nbsp.&nbsp.</html:button> <html:button
					property="" disabled="true">&nbsp?&nbsp</html:button></td>
				<td>
				<div id="partNew"></div>
				</td>
				<td><html:button property="clean" styleClass="button_small"
					onclick="clearPanelFilds();">
					<bean:message key="label.clean" />
				</html:button></td>
			</tr>

		</logic:equal>
		<!-- END Panel Mode Edit -->

		<!-- Titulos de de Propiedades de Pricing -->
	</table>
	<table style="width: 850px;" class="no_border">
		<tr>
			<td class="text_blue_bold align_left"><bean:message
				key="economicValue.label.tableHeader.currency" /></td>
			<td class="text_blue_bold align_left"><bean:message
				key="supply.label.table.header.price" /></td>
			<td class="text_blue_bold align_left"><bean:message
				key="supply.label.table.header.dateIn" /></td>
			<td class="text_blue_bold align_left"><bean:message
				key="supply.label.table.header.dateOut" /></td>
		</tr>
		<tr>
			<td class="text_blue_bold align_left"><html:select
				property="currencyNew">
				<html:option value="-1">-Seleccionar-</html:option>
				<html:options collection="economicMeasure"
					property="eesm01CurrencyCodeC" labelProperty="eesm01CurrencyCodeC" />
			</html:select></td>
			<td class="align_left"><html:text property="priceNew"
				maxlength="13" size="9" /></td>
			<td class="text_blue_bold align_left"><html:text
				styleId="dateInEffStartNew" property="dateInEffStartNew"
				maxlength="10" size="10" /><A name="dateInMinAnchorP"> </A><html:button
				property="calendar"
				onclick="cal.select(document.PricingForm.dateInEffStartNew,'dateInMinAnchorP','dd/MM/yyyy'); return false;"
				styleClass="button_small">...</html:button></td>
			<td class="text_blue_bold align_left"><html:text
				styleId="dateOutEffEndNew" property="dateOutEffEndNew"
				maxlength="10" size="10" /><A name="dateInMaxAnchorP"> </A><html:button
				property="calendar"
				onclick="cal.select(document.PricingForm.dateOutEffEndNew,'dateInMaxAnchorP','dd/MM/yyyy'); return false;"
				styleClass="button_small">...</html:button></td>
		</tr>

	</table>
	</div>
	</div>

	<br />

	<table class="no_border" style="width: 900px;">
		<tr>
			<td><display-el:table class="table1" style="width: 900px;"
				cellpadding="5" uid="pricing" pagesize="15"
				name="sessionScope.PricingForm.pricingS" excludedParams="*"
				requestURI="PricingActionPaginate.do">
				<display-el:column title="${supplierTitle}" style="width: 18%;"
					class="cell1 text_bold border1_right border1_top align_left"
					headerClass="header border_right">
							${pricing.teesp04Supply.teess01Supplier.eess01SupplierClassCodeC}&minus;
							${pricing.teesp04Supply.teess01Supplier.eess01SupplierCodeC}&minus;
							${pricing.teesp04Supply.teess01Supplier.eess01SupplierNameN}
					</display-el:column>
				<display-el:column title="${partTitle}" style="width: 18%;"
					class="cell1 text_bold border1_right border1_top align_left"
					headerClass="header border_right">
							${pricing.teesp04Supply.teesp01Part.eesp01PartClassCodeC}&minus;
							${pricing.teesp04Supply.teesp01Part.eesp01PartPrefixCodeC}&minus;
							${pricing.teesp04Supply.teesp01Part.eesp01PartBaseCodeC}&minus;
							${pricing.teesp04Supply.teesp01Part.eesp01PartSuffixCodeC}
					</display-el:column>
				<display-el:column title="${shareTitle}" property="sherePorc"
					style="width: 8%;"
					class="cell1 text_bold border1_right border1_top align_left"
					headerClass="header border_right" />

				<display-el:column title="${priceTitle}" style="width: 15%;"
					class="cell1 text_bold border1_right border1_top align_center"
					headerClass="header border_right">
									${pricing.eesp05CurrencyCodeC.eesm01CurrencyCodeC} &nbsp&nbsp ${pricing.eesp05PriceAmountA}
					</display-el:column>

				<display-el:column title="${dateIn}"
					property="eesp05PriceEffectiveDateY" style="width: 10%;"
					class="cell1 text_bold border1_right border1_top align_center"
					headerClass="header border_right"
					decorator="ar.com.ford.it.fullEconomics.view.displaytag.DateDecorator" />

				<display-el:column title="${dateOut}" property="eesp05PriceEndDateY"
					style="width: 10%;"
					class="cell1 text_bold border1_right border1_top align_center"
					headerClass="header border_right"
					decorator="ar.com.ford.it.fullEconomics.view.displaytag.DateDecorator" />

				<display-el:column title="${createTitle}"
					decorator="ar.com.ford.it.fullEconomics.view.displaytag.CostStructureItemColumnDecorator"
					style="width: 10%;"
					class="cell1 text_bold border1_right border1_top align_left"
					headerClass="header border_right">
					
						${pricing.eesp05CreateUserC}<br />${pricing.eesp05CreateS}
					
					</display-el:column>

				<display-el:column title="${uploadTitle}"
					decorator="ar.com.ford.it.fullEconomics.view.displaytag.CostStructureItemColumnDecorator"
					style="width: 8%;"
					class="cell1 text_bold border1_right border1_top align_left"
					headerClass="header border_right">
					
						${pricing.eesp05LastUpdtUserC}<br />${pricing.eesp05LastUpdtS}
						
					</display-el:column>
				<display-el:column title="${actionsTitle}" style="width: 6%;"
					class="cell1 text_bold border1_right border1_top align_left"
					headerClass="header border_right">

					<html:image property="" onclick="editPricing(${pricing_rowNum});"
						page="/images/edit.gif" style="width:20px" />&nbsp;
							<html:image property="" alt="${delete}"
						onclick="deletePricing(${pricing_rowNum});"
						page="/images/erase.gif" style="width:20px" />&nbsp;
		
					</display-el:column>
			</display-el:table></td>
		</tr>
	</table>
</html:form>
